package com.example.alteroracle.controller;


import com.example.alteroracle.base.response.JsonResult;
import com.example.alteroracle.pojo.po.Student;
import com.example.alteroracle.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/student/")
public class StudentController {

    @Autowired
    private StudentService  studentService;


    @GetMapping("select")
    public JsonResult getStudent(){
        List<Student> student = studentService.getStudent();
        return JsonResult.ok(student);
    }

    @PostMapping("add")
    public JsonResult addStudent(@RequestBody Student student){
        studentService.addStudent(student);
        return JsonResult.ok();
    }
}
